<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateOrdersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::dropIfExists('orders');
        Schema::create('orders', function (Blueprint $table) {
            $table->increments('id');
            $table->string('oprator_name', 25)->default("陕西")->comment('局方名称');
            $table->string('sp_name', 25)->comment('服务商名称');
            $table->string('order_no', 50)->comment('订单编号');
            $table->decimal('amount', 12, 2)->comment('订单金额');
            $table->unsignedTinyInteger('pay_state')->default(0)->comment('支付结果|1成功/0失败/其他未知');
            $table->unsignedTinyInteger('is_support_reconciliation')->default(0)->comment('是否支持对账');
            $table->string('vasseti_name', 100)->nullable()->comment('媒资名称');
            $table->unsignedTinyInteger('price_type')->default(1)->comment('定价类型');
            $table->string('mac')->nullable()->comment('机顶盒MAC地址');
            $table->string('card_id', 50)->index()->nullable()->comment('智能卡号');
            $table->string('content_id', 50)->index()->nullable()->comment('内容ID');
            $table->unsignedTinyInteger('result')->nullable()->comment('包月订购结果');
            $table->text('description')->nullable()->comment('结果描述');
            $table->string('service_code', 50)->nullable()->comment('服务code');
            $table->unsignedTinyInteger('service_type')->nullable()->comment('服务类型');
            $table->timestamps();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        //
    }
}
